import numpy as np
from python_ai.common.xcommon import *
import matplotlib.pyplot as plt

path = r'../../../../large_data/DL1/image_numpy/'
data = np.loadtxt(path + 'images.txt', delimiter=',')
check_shape(data, 'data')
data = data.reshape([-1, 28, 28])
labels = np.loadtxt(path + 'labels.txt', delimiter=',', dtype=np.int8)
check_shape(labels, 'labels')

spr = 4
spc = 6
spn = 0
plt.figure(figsize=[12, 8])

for i in range(spr * spc):
    img = data[i]
    spn += 1
    plt.subplot(spr, spc, spn)
    plt.axis('off')
    plt.imshow(img)
    plt.title(str(labels[i]))

plt.show()
